<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.flying.dcss.userpermissions.bo.impl.DcssUser"%>
<%@page import="com.flying.dcss.app.SessionName"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<style type="text/css">
.code { /*	background-image: url(image/code.jpg);*/
	font-family: Arial;
	font-style: italic;
	color: Red;
	border: 0;
	padding: 2px 3px;
	letter-spacing: 3px;
	font-weight: bolder;
	width: 120px;
	border: none;
}

.unchanged {
	border: 0;
}
</style>
		<script language="javascript" type="text/javascript">
var code; //在全局 定义验证码
function createCode() {
	code = "";
	var codeLength = 4;//验证码的长度
	var checkCode = document.getElementById("checkCode");
	checkCode.value = "";

	var selectChar = new Array(2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E',
			'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T',
			'U', 'V', 'W', 'X', 'Y', 'Z');

	for ( var i = 0; i < codeLength; i++) {
		var charIndex = Math.floor(Math.random() * 32);
		code += selectChar[charIndex];
	}
	if (code.length != codeLength) {
		createCode();
	}
	checkCode.value = code;
}

function validate() {
	var inputCode = document.getElementById("inputCode").value.toUpperCase();

	if (inputCode.length <= 0) {
		alert("请输入验证码！");
		return false;
	} else if (inputCode != code) {
		alert("验证码输入错误！");
		createCode();
		return false;
	}
}
</script>


		<base href="<%=basePath%>">
		<title>Register</title>

		<link rel="stylesheet" type="text/css" href="style/element.css">
	</head>

	<body onload="createCode();"
		style="background: url(images/bodyBG.gif) repeat-x;">
		<%
			if (session.getAttribute(SessionName.UserSession) != null) {
				response.sendRedirect(basePath + "home/index.jsp");
				return;
			}
		%>
		<div class="main">
			<s:form name="registerForm" onsubmit="return validate();"
				action="account/register.do" method="post">

				<div id="login">
					<div id="loginLogo">
						<img src="images/Loginlogo.gif" />
					</div>
					<div id="loginContent">
						<h1>
							用户注册
						</h1>
						<div class="loginbar">
							<span class="loginbarleft">用户名：</span>
							<!-- <input name="" type="text" class="logintxb" /> -->
							<s:textfield name="user.username" cssClass="logintxb"
								equired="true" />
						</div>
						<div id="loginbar2" class="loginbar">
							<span class="loginbarleft">密码：</span>
							<!-- <input name="" type="text" class="logintxb" />  -->
							<s:password name="user.password" cssClass="logintxb"
								required="true" />
						</div>
						<div class="loginbar">
							<span class="loginbarleft">确认密码：</span>
							<input name="" type="text" class="logintxb" />
						</div>
						<div id="loginbar2" class="loginbar">
							<span class="loginbarleft">邮箱：</span>
							<!--  <input name="" type="text" class="logintxb" />  -->
							<s:textfield name="user.email" cssClass="logintxb"
								required="true" />
						</div>
						<div class="loginbar">
							<span class="loginbarleft">手机号：</span>
							<s:textfield name="user.phoneNum" cssClass="logintxb" />
						</div>
						<div class="loginbar">
							<span class="loginbarleft">二级密码：</span>
							<s:textfield name="user.securityCode" type="text"
								cssClass="logintxb" />
						</div>
						<div class="loginbar">
							<span class="loginbarleft">验证码：</span>
							<input type="text" style="width: 120px;" id="inputCode"
								class="logintxb" />
							<input name="" type="text" id="checkCode" style="width: 60px;"
								readonly="readonly" class="logintxb" />
							<a href="<%=basePath%>account/register.jsp">看不清楚</a>
						</div>

						<div class="loginbtn">
							<!-- <input name="" type="button" value="注册" id="loginBtn" />  -->
							<s:submit name="" type="button" value="注册" id="loginBtn" />
						</div>
					</div>
				</div>
				<div class="footer">
					版权归华中科技大学软件学院所有 Copyright Reserved
				</div>
			</s:form>
		</div>

	</body>
</html>
